from langchain.chat_models import init_chat_model
from langchain.agents import load_chat_planner

llm = init_chat_model(
    model_provider="openai",
    model="qwen/qwq-32b:free",
    base_url="https://openrouter.ai/api/v1",
    api_key="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",
)

# 2. 加载 Chat Planner
planner = load_chat_planner(llm)

# 3. 运行 Planner
output = planner.plan("帮我推荐一本前端开发的书籍")
print(output)
